package com.mooc.ppjoke.data;

import android.text.TextUtils;

import androidx.annotation.Nullable;
import androidx.databinding.BaseObservable;
import androidx.databinding.Bindable;

import java.io.Serializable;

/**
 * @ClassName: Feed$
 * @Description: java类作用描述
 * @Author: 魏靳元
 * @CreateDate: 2022/8/16 15:25
 * @UpdateRemark: 更新内容
 * @Version: 1.0
 */
public class Feed extends BaseObservable implements Serializable {
    public static final int TYPE_IMAGE = 1;//图文
    public static final int TYPE_VIDEO = 2;//视频

    public int id;
    public long itemId;
    public int itemType;
    public long createTime;
    public double duration;
    public String feeds_text;
    public long authorId;
    public String activityIcon;
    public String activityText;
    public int width;
    public int height;
    public String url;
    public String cover;
    public User author;
    public Comment comment;//神评
    public Ugc ugc;//点赞分享评论数量
    @Bindable
    public User getAuthor() {
        return author;
    }


    @Bindable
    public Ugc getUgc(){
        if(ugc==null){
            ugc= new Ugc();
        }

        return ugc;}

    @Override
    public boolean equals(@Nullable @org.jetbrains.annotations.Nullable Object obj) {
        if (obj == null || !(obj instanceof Feed))
            return false;
        Feed newFeed = (Feed) obj;
        return id == newFeed.id
                && itemId == newFeed.itemId
                && itemType == newFeed.itemType
                && createTime == newFeed.createTime
                && duration == newFeed.duration
                && TextUtils.equals(feeds_text, newFeed.feeds_text)
                && authorId == newFeed.authorId
                && TextUtils.equals(activityIcon, newFeed.activityIcon)
                && TextUtils.equals(activityText, newFeed.activityText)
                && width == newFeed.width
                && height == newFeed.height
                && TextUtils.equals(url, newFeed.url)
                && TextUtils.equals(cover, newFeed.cover)
                && (author != null && author.equals(newFeed.author))
                && (comment != null && comment.equals(newFeed.comment))
                && (ugc != null && ugc.equals(newFeed.ugc));
    }
}
